package com.ruoyi.edh.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.edh.mapper.EdhScheduledMapper;
import com.ruoyi.edh.domain.EdhScheduled;
import com.ruoyi.edh.service.IEdhScheduledService;

/**
 * 易订货-排期Service业务层处理
 * 
 * @author xxx
 * @date 2020-09-22
 */
@Service
public class EdhScheduledServiceImpl implements IEdhScheduledService 
{
    @Autowired
    private EdhScheduledMapper edhScheduledMapper;

    /**
     * 查询易订货-排期
     * 
     * @param id 易订货-排期ID
     * @return 易订货-排期
     */
    @Override
    public EdhScheduled selectEdhScheduledById(Long id)
    {
        return edhScheduledMapper.selectEdhScheduledById(id);
    }

    /**
     * 查询易订货-排期列表
     * 
     * @param edhScheduled 易订货-排期
     * @return 易订货-排期
     */
    @Override
    public List<EdhScheduled> selectEdhScheduledList(EdhScheduled edhScheduled)
    {
        return edhScheduledMapper.selectEdhScheduledList(edhScheduled);
    }

    /**
     * 新增易订货-排期
     * 
     * @param edhScheduled 易订货-排期
     * @return 结果
     */
    @Override
    public int insertEdhScheduled(EdhScheduled edhScheduled)
    {
        edhScheduled.setCreateBy(SecurityUtils.getUserId()+"");
        return edhScheduledMapper.insertEdhScheduled(edhScheduled);
    }

    /**
     * 修改易订货-排期
     * 
     * @param edhScheduled 易订货-排期
     * @return 结果
     */
    @Override
    public int updateEdhScheduled(EdhScheduled edhScheduled)
    {
        edhScheduled.setUpdateBy(SecurityUtils.getUserId()+"");
        return edhScheduledMapper.updateEdhScheduled(edhScheduled);
    }

    /**
     * 批量删除易订货-排期
     * 
     * @param ids 需要删除的易订货-排期ID
     * @return 结果
     */
    @Override
    public int deleteEdhScheduledByIds(Long[] ids)
    {
        return edhScheduledMapper.deleteEdhScheduledByIds(ids);
    }

    /**
     * 批量删除易订货-排期
     *
     * @param id
     * @param goodsId
     */
    @Override
    public int editscheduledgoods(Long id, Long[] goodsId) {
        int i = edhScheduledMapper.deleteEdhScheduledGoodsByScheduledId(id);
        edhScheduledMapper.batchInsert(id,goodsId);
        return 1;
    }

    /**
     * 删除易订货-排期信息
     * 
     * @param id 易订货-排期ID
     * @return 结果
     */
    @Override
    public int deleteEdhScheduledById(Long id)
    {
        return edhScheduledMapper.deleteEdhScheduledById(id);
    }
}
